package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.HashMap;

@Setter
@Getter
@ToString
public class ClassInfo {
    private Long id;

    private String name;

    private Integer number;

    private Long employeeId;
    //关联属性
    private Employee employee;



    //获取json数据
    public String getJson(){
        HashMap<Object, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("number",number);
        map.put("employeeId",employee.getId());
        //这里不能传this,会死循环
        return JSON.toJSONString(map);
}
}